<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<%@ page language="java" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Hotel da Esta&ccedil;&atilde;o</title>

<link type="text/css" rel="stylesheet" href="css/hotel.css" />
<script type="text/javascript" src="js/jquery-1.2.6.js"></script>

<script type="text/javascript">
$(document).ready(function(){
	$("#entrar").click(function(){
		$("#alerta").html("Preencha o campo.");
		$("#alerta").css("display","none");
		$("#label_login").css({color:"black", fontWeight:"normal"});
		$("#label_senha").css({color:"black", fontWeight:"normal"});
		
		if($("#login").val() == $("#login").attr("defaultValue")){
			$("#alerta").css("display","block");
			$("#label_login").css({color:"red", fontWeight:"bold"});
			$("#login").focus();
			return false;
		}
		if($("#senha").val() == $("#senha").attr("defaultValue")){
			$("#alerta").css("display", "block");
			$("#label_senha").css({color:"red", fontWeight:"bold"});
			$("#senha").focus();
			return false;
		}

		$.post("../src/.../validaLogin.java",{login:$("#login").val(), senha:$("#senha").val()},
				function(data){
					if(data == "true"){
						document.location.href="web/inicio.html";
					}else{
						$("#alerta").html("Login/Senha incorretos.");
						$("#alerta").css("display", "block");
						return false;
					}		
		});
		return false;
	});
});
</script>

</head>
<body>

<div id="header">
	<h1>Hotel da Esta&ccedil;&atilde;o</h1>
</div>

<div id="main_login">
	<p id="p_login">
		<span id="alerta" class="alerta center">&nbsp;</span>
		<span class="left">
			<label id="label_login" for="login">Login:</label><br />
			<label id="label_senha" for="senha">Senha:</label>
		</span>
		<span class="right">
			<input type="text" name="login" id="login" size="9" /><br />
			<input type="password" name="senha" id="senha" size="9" />
		</span>
		<input type="submit" id="entrar" value="Entrar" />
	</p>
</div>

<div id="footer">
	&copy; 2010, Hotel da Esta&ccedil;&atilde;o - Todos os direitos reservados.
</div>

</body>
</html>